import Vue from 'vue'
import App from './App'
import store from '@/store/index.js'
import http from '@/api/http.js'
import login from './utils/login.js'
import loginToutiao from './utils/login_toutiao.js'
import getApp from '@/utils/getApp.js'
import mixin from '@/utils/global.mixin.js'
import {toPath} from "@/utils/toPath.js"
import {optionsManager, global_config} from '@/utils/utils.js'

Vue.config.productionTip = false

Vue.prototype.$store = store;
Vue.prototype.$http = http;
Vue.prototype.$login = login;
Vue.prototype.$loginToutiao = loginToutiao;
Vue.prototype.$getApp = getApp;
Vue.prototype.$toPath = toPath;
Vue.prototype.$optionsManager = optionsManager;

// #ifdef H5
import getClientInfo  from '@/utils/client.js'
import share from "@/utils/share.js"
Vue.prototype.$share = share;
// #endif

// #ifdef MP-ALIPAY || MP-BAIDU || MP-WEIXIN || MP-TOUTIAO
import mpShare from "@/utils/mpShare.js"
Vue.prototype.$mpShare = mpShare;
// #endif

Vue.use(mixin);

App.mpType = 'app'

const app = new Vue({
	...App
})

;(async () => {
	// #ifdef H5
	//h5第一次请求为空处理
	let clientId = uni.getStorageSync('client_id')
	if (!clientId) {
		await getClientInfo()
	}
	// #endif
	
	app.$mount()
})()
